package com.v.movie.代码;

import java.awt.BorderLayout;

import java.awt.Cursor;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.ImageIcon;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

import javax.swing.border.EmptyBorder;

public class JScrollPaneDemo extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 5695137474057773951L;

	private JLabel kuangjia;// 框架
	private JLabel Film_album;// 电影专辑
	private JLabel Film_album1;// 电影专辑
	private JLabel Film_album2;// 电影专辑
	private JLabel Film_album3;// 电影专辑
	private JLabel Film_album4;// 电影专辑
	private JLabel Film_album5;// 电影专辑

	private JLabel Film_introduction;// 电影简介
	private JLabel Film_introduction1;// 电影简介
	private JLabel Film_introduction2;// 电影简介
	private JLabel Film_introduction3;// 电影简介
	private JLabel Film_introduction4;// 电影简介
	private JLabel Film_introduction5;// 电影简介

	// 显示一个小手
	private Cursor hand = new Cursor(Cursor.HAND_CURSOR);

	private JPanel contentPane;
	private JScrollPane scrollPane;

	public JScrollPaneDemo() {
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		this.setContentPane(contentPane);
		scrollPane = new JScrollPane();
		contentPane.add(scrollPane, BorderLayout.CENTER);
		kuangjia = new JLabel(new ImageIcon(JScrollPaneDemo.class.getResource("背景图片.png")));
		// 868 623
		Film_album = new JLabel(new ImageIcon(JScrollPaneDemo.class.getResource("荡寇风云.jpg")));
		Film_album.setBounds(60, 2, 220, 230);
		Film_album.setCursor(hand);// 放上去显示小手
		Film_album.addMouseListener(new MouseAdapter() {
			// 鼠标放上去
			@Override
			public void mouseEntered(MouseEvent e) {
				Film_album.setIcon(new ImageIcon(JScrollPaneDemo.class.getResource("荡寇风云-播放.jpg")));
			}

			// 鼠标离开时
			@Override
			public void mouseExited(MouseEvent e) {
				Film_album.setIcon(new ImageIcon(JScrollPaneDemo.class.getResource("荡寇风云.jpg")));
			}
		});
		kuangjia.add(Film_album);

		Film_introduction = new JLabel(new ImageIcon(JScrollPaneDemo.class.getResource("荡寇风云简介.jpg")));
		Film_introduction.setBounds(60, 140, 220, 230);
		kuangjia.add(Film_introduction);

		Film_album1 = new JLabel(new ImageIcon(JScrollPaneDemo.class.getResource("钢琴教师.jpg")));
		Film_album1.setBounds(312, 2, 220, 230);
		Film_album1.setCursor(hand);// 放上去显示小手
		Film_album1.addMouseListener(new MouseAdapter() {
			// 鼠标放上去
			@Override
			public void mouseEntered(MouseEvent e) {
				Film_album1.setIcon(new ImageIcon(JScrollPaneDemo.class.getResource("钢琴教师-播放.jpg")));
			}

			// 鼠标离开时
			@Override
			public void mouseExited(MouseEvent e) {
				Film_album1.setIcon(new ImageIcon(JScrollPaneDemo.class.getResource("钢琴教师.jpg")));
			}
		});
		kuangjia.add(Film_album1);

		Film_introduction1 = new JLabel(new ImageIcon(JScrollPaneDemo.class.getResource("钢琴教师简介.jpg")));
		Film_introduction1.setBounds(312, 140, 220, 230);
		kuangjia.add(Film_introduction1);

		Film_album2 = new JLabel(new ImageIcon(JScrollPaneDemo.class.getResource("攀登者.jpg")));
		Film_album2.setBounds(554, 2, 220, 230);
		Film_album2.setCursor(hand);// 放上去显示小手
		Film_album2.addMouseListener(new MouseAdapter() {
			// 鼠标放上去
			@Override
			public void mouseEntered(MouseEvent e) {
				Film_album2.setIcon(new ImageIcon(JScrollPaneDemo.class.getResource("攀登者-播放.jpg")));
			}

			// 鼠标离开时
			@Override
			public void mouseExited(MouseEvent e) {
				Film_album2.setIcon(new ImageIcon(JScrollPaneDemo.class.getResource("攀登者.jpg")));
			}
		});
		kuangjia.add(Film_album2);

		Film_introduction2 = new JLabel(new ImageIcon(JScrollPaneDemo.class.getResource("攀登者简介.jpg")));
		Film_introduction2.setBounds(554, 140, 220, 230);
		kuangjia.add(Film_introduction2);

		Film_album3 = new JLabel(new ImageIcon(JScrollPaneDemo.class.getResource("审死官.jpg")));
		Film_album3.setBounds(60, 310, 220, 230);
		Film_album3.setCursor(hand);// 放上去显示小手
		Film_album3.addMouseListener(new MouseAdapter() {
			// 鼠标放上去
			@Override
			public void mouseEntered(MouseEvent e) {
				Film_album3.setIcon(new ImageIcon(JScrollPaneDemo.class.getResource("审死官-播放.jpg")));
			}

			// 鼠标离开时
			@Override
			public void mouseExited(MouseEvent e) {
				Film_album3.setIcon(new ImageIcon(JScrollPaneDemo.class.getResource("审死官.jpg")));
			}
		});
		kuangjia.add(Film_album3);

		Film_introduction3 = new JLabel(new ImageIcon(JScrollPaneDemo.class.getResource("审死官简介.jpg")));
		Film_introduction3.setBounds(60, 455, 220, 230);
		kuangjia.add(Film_introduction3);

		Film_album4 = new JLabel(new ImageIcon(JScrollPaneDemo.class.getResource("叶问外传：张天志.jpg")));
		Film_album4.setBounds(312, 310, 220, 230);
		Film_album4.setCursor(hand);// 放上去显示小手
		Film_album4.addMouseListener(new MouseAdapter() {
			// 鼠标放上去
			@Override
			public void mouseEntered(MouseEvent e) {
				Film_album4.setIcon(new ImageIcon(JScrollPaneDemo.class.getResource("叶问外传：张天志-播放.jpg")));
			}

			// 鼠标离开时
			@Override
			public void mouseExited(MouseEvent e) {
				Film_album4.setIcon(new ImageIcon(JScrollPaneDemo.class.getResource("叶问外传：张天志.jpg")));
			}
		});
		kuangjia.add(Film_album4);

		Film_introduction4 = new JLabel(new ImageIcon(JScrollPaneDemo.class.getResource("叶问外传：张天志简介.jpg")));
		Film_introduction4.setBounds(312, 455, 220, 230);
		kuangjia.add(Film_introduction4);

		Film_album5 = new JLabel(new ImageIcon(JScrollPaneDemo.class.getResource("云南虫谷.jpg")));
		Film_album5.setBounds(554, 310, 220, 230);
		Film_album5.setCursor(hand);// 放上去显示小手
		Film_album5.addMouseListener(new MouseAdapter() {
			// 鼠标放上去
			@Override
			public void mouseEntered(MouseEvent e) {
				Film_album5.setIcon(new ImageIcon(JScrollPaneDemo.class.getResource("云南虫谷-播放.jpg")));
			}

			// 鼠标离开时
			@Override
			public void mouseExited(MouseEvent e) {
				Film_album5.setIcon(new ImageIcon(JScrollPaneDemo.class.getResource("云南虫谷.jpg")));
			}
		});
		kuangjia.add(Film_album5);

		Film_introduction5 = new JLabel(new ImageIcon(JScrollPaneDemo.class.getResource("云南虫谷简介.jpg")));
		Film_introduction5.setBounds(554, 455, 220, 230);
		kuangjia.add(Film_introduction5);
		// scrollPane.add(textArea);
		scrollPane.setViewportView(kuangjia);

		this.setTitle("滚动面板使用");
		this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		this.setResizable(false);
		this.setBounds(0, 0, 870, 645);
		this.setVisible(true);
	}

	public static void main(String[] args) {
		new JScrollPaneDemo();
	}
}